import axios from "axios";
var chart_7903886550954bf486a1fa98a1b03658 = echarts.init(
    document.getElementById('7903886550954bf486a1fa98a1b03658'), 'white', { renderer: 'canvas' });
var option_7903886550954bf486a1fa98a1b03658 = {
    "animation": true,
    "animationThreshold": 2000,
    "animationDuration": 1000,
    "animationEasing": "cubicOut",
    "animationDelay": 0,
    "animationDurationUpdate": 300,
    "animationEasingUpdate": "cubicOut",
    "animationDelayUpdate": 0,
    "color": [
        "#5fb6ff",
        "#6c82ee",
        "#6c78b3",
        "#5957b4",
        "#834feb",
        "#099fa1",
        "#834feb",
        "#099fa1"
    ],
    "series": [
        {
            "type": "pie",
            "clockwise": true,
            "data": [
                {
                    "name": "A\u8f6e",
                    "value": 11
                },
                {
                    "name": "B\u8f6e",
                    "value": 9
                },
                {
                    "name": "C\u8f6e",
                    "value": 6
                },
                {
                    "name": "D\u8f6e\u53ca\u4ee5\u4e0a",
                    "value": 22
                },
                {
                    "name": "\u4e0d\u9700\u8981\u878d\u8d44",
                    "value": 60
                },
                {
                    "name": "\u5929\u4f7f\u8f6e",
                    "value": 20
                },
                {
                    "name": "\u5df2\u4e0a\u5e02",
                    "value": 66
                },
                {
                    "name": "\u672a\u878d\u8d44",
                    "value": 67
                }
            ],
            "radius": [
                "20%",
                "40%"
            ],
            "center": [
                "25%",
                "50%"
            ],
            "roseType": "radius",
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
            "labelLine": {
                "show": true,
                "length": 5,
                "length2": 5,
                "smooth": false
            },
            "xAxisIndex": 0,
            "yAxisIndex": 0
        },
        {
            "type": "pie",
            "clockwise": true,
            "data": [
                {
                    "name": "0-19",
                    "value": 42
                },
                {
                    "name": "20-99",
                    "value": 61
                },
                {
                    "name": "100-499",
                    "value": 47
                },
                {
                    "name": "500-999",
                    "value": 17
                },
                {
                    "name": "1000-4999",
                    "value": 0
                },
                {
                    "name": "5000-9999",
                    "value": 116
                },
                {
                    "name": "10000\u4ee5\u4e0a",
                    "value": 0
                }
            ],
            "radius": [
                "20%",
                "30%"
            ],
            "center": [
                "75%",
                "50%"
            ],
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
            "labelLine": {
                "show": true,
                "length": 5,
                "length2": 5,
                "smooth": false
            },
            "xAxisIndex": 1,
            "yAxisIndex": 1
        }
    ],
    "legend": [
        {
            "data": [
                "A\u8f6e",
                "B\u8f6e",
                "C\u8f6e",
                "D\u8f6e\u53ca\u4ee5\u4e0a",
                "\u4e0d\u9700\u8981\u878d\u8d44",
                "\u5929\u4f7f\u8f6e",
                "\u5df2\u4e0a\u5e02",
                "\u672a\u878d\u8d44"
            ],
            "selected": {},
            "show": false,
            "padding": 5,
            "itemGap": 10,
            "itemWidth": 25,
            "itemHeight": 14
        },
        {
            "data": [
                "0-19",
                "20-99",
                "100-499",
                "500-999",
                "1000-4999",
                "5000-9999",
                "10000\u4ee5\u4e0a"
            ],
            "selected": {},
            "show": false,
            "padding": 5,
            "itemGap": 10,
            "itemWidth": 25,
            "itemHeight": 14
        }
    ],
    "tooltip": {
        "show": true,
        "trigger": "item",
        "triggerOn": "mousemove|click",
        "axisPointer": {
            "type": "line"
        },
        "showContent": true,
        "alwaysShowContent": false,
        "showDelay": 0,
        "hideDelay": 100,
        "textStyle": {
            "fontSize": 14
        },
        "borderWidth": 0,
        "padding": 5
    },
    "title": [
        {
            "text": "\u00b7\u878d\u8d44\u60c5\u51b5",
            "top": 10,
            "padding": 5,
            "itemGap": 10,
            "textStyle": {
                "color": "#d4d4d4",
                "fontWeight": "normal",
                "fontFamily": "\u534e\u6587\u7ec6\u9ed1",
                "fontSize": 18
            }
        },
        {
            "text": "\u00b7\u516c\u53f8\u89c4\u6a21",
            "left": "55%",
            "top": 10,
            "padding": 5,
            "itemGap": 10,
            "textStyle": {
                "color": "#d4d4d4",
                "fontWeight": "normal",
                "fontFamily": "\u534e\u6587\u7ec6\u9ed1",
                "fontSize": 18
            }
        }
    ],
    "grid": [
        {
            "show": false,
            "zlevel": 0,
            "z": 2,
            "containLabel": false,
            "backgroundColor": "transparent",
            "borderColor": "#ccc",
            "borderWidth": 1
        },
        {
            "show": false,
            "zlevel": 0,
            "z": 2,
            "containLabel": false,
            "backgroundColor": "transparent",
            "borderColor": "#ccc",
            "borderWidth": 1
        }
    ]
};
chart_7903886550954bf486a1fa98a1b03658.setOption(option_7903886550954bf486a1fa98a1b03658);
window.addEventListener('resize', function () {
    chart_7903886550954bf486a1fa98a1b03658.resize();
})
const getPieData = (city) => {
    return axios.get(city + '/companyPeople')
}
const getRosePieData = (city) => {
    return axios.get(city + '/companySituation')   
}
export const getPieAllData = (city) => {
    axios.all([getPieData(city),getRosePieData(city)])
    .then(axios.spread(function (pieData,rosePieData){
        option_7903886550954bf486a1fa98a1b03658.series[0].data = rosePieData.data
        option_7903886550954bf486a1fa98a1b03658.series[1].data = pieData.data

        chart_7903886550954bf486a1fa98a1b03658.setOption(option_7903886550954bf486a1fa98a1b03658);
        window.addEventListener('resize', function () {
            chart_7903886550954bf486a1fa98a1b03658.resize();
        })
    }))
    .catch(function (error) { // 请求失败处理
        console.log(error);
    })
}